home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
vtkermit.arc
/
MENU.DOC
< prev
next >
Wrap
INI File
|
1986-02-13
|
7KB
|
163 lines
[MENU.DOC] -- Documentation for VTKermit's Menu Facility -- 1 Feb 1986
VTKermit's Menu Facility is a mechanism which permits you to present a user
with a simplified menu interface instead of the normal VTKermit> prompt. The
issue here is not simply commands versus menus, since the two modes are not
equivalent. Basically, menus allow a VTKermit customizer to build a "turnkey"
system to be used by less-sophistated users.
The VTKermit software has three major modes, each of which has submodes. The
major modes are:
1) Terminal mode, in which VTKermit emulates a DEC VT100 terminal;
2) File transfer mode, in which VTKermit sends or receives files in either
of the Kermit or XMODEM protocols; and
3) Command mode, which is used to set parameters and control the program.
Menu mode is a submode of command mode. A MENU command issued while at the
VTKermit> prompt (or from within a command file, or from the command line)
will immediately search for the selected menu file (VTKERMIT.MNU by default)
and display it, as described in later paragraphs. Alternatively, a SET MODE
MENU command will cause the program to display the menu at any time that it
would ordinarily present its "VTKermit> " prompt and wait for keyboard input.
You may specify the name of the menu file with a SET MENU-FILE command. If
you don't do this, the name of the menu file will be VTKERMIT.MNU.
A menu (as displayed onscreen) is a box containing a title line and a number
of items to choose between. When the menu is first displayed, a highlight bar
will appear over the first of the items. You can move the highlight bar up
and down in predictable ways: up-arrow and down-arrow move the bar up and
down (as do left- and right-arrow), while Home and PgUp move to the top item
and End and PgDn move to the last item. Once you have moved the highlight bar
to the item you want, press Enter (CR) to select it.
Alternatively, you can type a letter (or number or other single ASCII
character) to immediately select the next item which begins with that letter.
If you type a character that does not begin any menu item, the program will
beep at you.
Finally, if none of the displayed items is what you want, you can type
CONTROL-C to break yourself out of the menu and return to the command prompt.
This protects you in case you build a menu that won't do what you want. (You
can always get out.)
Menu files are normal ASCII text files with lines ending in CR-LF. There are
three types of lines in a menu file.
1) The file should begin with a line starting with a percent-sign. This
line will be used as the title of the menu, and the text on the line
will be displayed at the top of the menu.
2) The line following the title should begin with an asterisk. This line
is an item label, and will be displayed as the first item in the menu.
You may want to force each item label to begin (after the asterisk)
with a unique character, because items are selectable by typing their
first character (as in Lotus 1-2-3 and many other programs).
3) The third line in the file should begin with a plus-sign. This line
contains text to be executed as a normal VTKermit command. Following
the third line of the file, additional lines may be either command
lines or item labels. Item labels should be separated by command
lines, and there may be only one title line, the first line in the
file.
A simple example will help to clarify this. The following menu allows the
user only three options: Push (to new COMMAND.COM), Exit (to DOS) or Connect
(to terminal mode).
%This is a very simple example of a menu file
*Push (to new COMMAND.COM)
+Push
*Exit (to DOS)
+Exit
*Connect (to terminal mode)
+Connect
Much more complex menu structures may be constructed. In fact, by using the
SET MODE MENU and SET MENU-FILE commands, a tree structured menu arrangement
may be built in which selecting a menu item causes a second menu to be
displayed. The following trio of menu files works this way.
[VTKERMIT.MNU]
%Main Menu
*1 -- Select submenu 1
+Set Mode Menu
+Set Menu-File Menu1.Mnu
*2 -- Select submenu 2
+Set Mode Menu
+Set Menu-File Menu2.Mnu
[MENU1.MNU]
%Submenu 1
*A -- Option A
+Set Menu-File VTKermit.Mnu
+Echo Option A selected from submenu 1
*B -- Option B
+Set Menu-File VTKermit.Mnu
+Echo Option B selected from submenu 1
[MENU2.MNU]
%Submenu 2
*A -- Option A
+Set Menu-File VTKermit.Mnu
+Echo Option A selected from submenu 2
*B -- Option B
+Set Menu-File VTKermit.Mnu
+Echo Option B selected from submenu 2
These are all useless menus, but you get the idea. For a working example of a
menu, see the VTKermit.Mnu file included in the distribution of VTKermit.
Technical facts and gotchas:
1) Empty text blocks (two item labels in a row) will cause problems, as
will almost all violations of these rules. SET MENU-FILE JUNK.JNK
(where JUNK.JNK is not a valid menu file) will either die or be very
ugly.
2) There is a maximum of 20 menu items in a menu. Beyond this limit, you
should use multiple menus.
3) The size of a text block (the set of lines beginning with plus-signs
following an item label) is limited to a total of 255 characters.
If you need to invoke a set of commands longer than this, you must use
a command file and invoke it with a TAKE command in the text block.
4) The text blocks are executed by creating an "instant-macro" similar to
one which you would create with the DEFINE command. This means that
you may be unable to run menus from deeply nested TAKE files. This is
probably not a problem in real life.
5) In the interest of higher performance, menus are not reread unless an
explicit SET MENU-FILE command is issued. That is, a menu file will
be read the first time the menu is invoked, but if you leave the menu
(by selecting an item) and later return to the menu, you will reuse
the memory buffer holding the menu file from the last time. This is
faster than rereading from disk, but it means that if you alter the
menu file you must give a SET MENU-FILE command to make it be read.
6) Dynamically allocated memory is used to hold the menu file, so if you
don't have enough memory you may be able to run VTKermit but not use
menus.
7) The maximum size of a menu file is something less than 7400 bytes. This
is an assembly parameter and could be changed, at the expense of
memory piggishness. Remember that text blocks are limited anyway, so
a larger buffer would not buy much.
8) The displayed menu is automatically sized and centered vertically and
horizontally on the screen -- you don't have to do anything, but you
can't change it either.
9) Since each item label is shown on a separate line, and is bounded by
spaces and vertical lines, the length of an item label must be 74
characters or shorter.
10) Unfortunately, due to the highly screen-oriented nature of the menu
display, the code has been written to run only on the IBM PC family
(including "100%" compatibles). Someone who cared enough could
probably adapt it to another machine.
[End of MENU.DOC]